import service from "@/service";
//查询【组织树】
export function getUserTree(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/getOrgTreeByQx`,
    method: "POST",
    data,
  });
}

//查询【用户列表】
export function getUserManageList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/list?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

//【删除用户】
export function getUserDelete(id) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/delete?id=${id}`,
    method: "POST",
  });
}

//【下载模板】
export function getUserTemplate(tenantCode) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/downloadTemplate?tenantCode=${tenantCode}`,
    method: "GET",
    apiType: "file",
    responseType: "arraybuffer",
  });
}

//【密码重置】
export function getUserReset(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/passwordReset`,
    method: "POST",
    data,
  });
}

//【用户新增】
export function getUserAdd(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/add`,
    method: "POST",
    data,
  });
}

//查询【角色下拉框】
export function getUserRole(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-role/getRoleListByTenantCode`,
    method: "GET",
    params,
  });
}

//查询【人员详情】
export function getUserDetails(id) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/detail?userId=${id}`,
    method: "GET",
  });
}

//【用户批量导入】
export function getUserImport(formdata, tenantCode) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/importExcel?tenantCode=${tenantCode}`,
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: formdata,
  });
}

//用户操作按钮权限
export function getPurView() {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-user/superUserFlag`,
    method: "GET",
  });
}
